#ifndef _RESPONSE_H_
#define _RESPONSE_H_

#include "connector.h"
#include "map"
#include "string"
#include "unistd.h"

using namespace std;

namespace easyWebServer
{

class Response
{
public:
    Response() = delete;
    Response(int fd);
    ~Response();

    void setContext(const string & src, const string & httpCode = "200 OK", const string & http = "HTTP/1.1");

    string & operator [] (const string & key);

    void insertPair(const string & key, const string & value);

    void setFileFd(int fd);

public:
    void send();
    void sendFile(int fd);


private:
    int m_fd = -1;
    Connector m_conn;
    map<string, string> m_context;
    string m_out;
    int m_fileFd = -1;

};


}


#endif